<html>
<head>
  <title>../ex12f.f</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<a href="../ex12f.f">download the original source code</a>.
<pre>
<a name="line1">  1</a> <font color="#444444">c     </font>
<a name="line2">  2</a> <font color="#444444">c     Example 12</font>
<a name="line3">  3</a> <font color="#444444">c     </font>
<a name="line4">  4</a> <font color="#444444">c     Interface:    Semi-Structured interface (SStruct)</font>
<a name="line5">  5</a> <font color="#444444">c     </font>
<a name="line6">  6</a> <font color="#444444">c     Compile with: make ex12f (may need to edit HYPRE_DIR in Makefile)</font>
<a name="line7">  7</a> <font color="#444444">c  </font>
<a name="line8">  8</a> <font color="#444444">c     Sample runs:  mpirun -np 2 ex12f</font>
<a name="line9">  9</a> <font color="#444444">c  </font>
<a name="line10"> 10</a> <font color="#444444">c     Description: The grid layout is the same as ex1, but with nodal</font>
<a name="line11"> 11</a> <font color="#444444">c     unknowns. The solver is PCG preconditioned with either PFMG or</font>
<a name="line12"> 12</a> <font color="#444444">c     BoomerAMG, set with 'precond_id' below.</font>
<a name="line13"> 13</a> <font color="#444444">c  </font>
<a name="line14"> 14</a> <font color="#444444">c     We recommend viewing the Struct examples before viewing this and</font>
<a name="line15"> 15</a> <font color="#444444">c     the other SStruct examples.  This is one of the simplest SStruct</font>
<a name="line16"> 16</a> <font color="#444444">c     examples, used primarily to demonstrate how to set up</font>
<a name="line17"> 17</a> <font color="#444444">c     non-cell-centered problems, and to demonstrate how easy it is to</font>
<a name="line18"> 18</a> <font color="#444444">c     switch between structured solvers (PFMG) and solvers designed for</font>
<a name="line19"> 19</a> <font color="#444444">c     more general settings (AMG).</font>
<a name="line20"> 20</a> <font color="#444444">c  </font>
<a name="line21"> 21</a> 
<a name="line22"> 22</a>       <strong>program</strong> <font color="#2040a0">ex12f</font>
<a name="line23"> 23</a> 
<a name="line24"> 24</a>       <strong>implicit</strong> <strong>none</strong>
<a name="line25"> 25</a> 
<a name="line26"> 26</a>       <strong>include</strong> '<font color="#2040a0">mpif</font>.<font color="#2040a0">h</font>'
<a name="line27"> 27</a>       <strong>include</strong> '<font color="#2040a0">HYPREf</font>.<font color="#2040a0">h</font>'
<a name="line28"> 28</a> 
<a name="line29"> 29</a>       <strong>integer</strong>    <font color="#2040a0">ierr</font>
<a name="line30"> 30</a>       <strong>integer</strong>    <font color="#2040a0">i</font>, <font color="#2040a0">j</font>, <font color="#2040a0">myid</font>, <font color="#2040a0">num_procs</font>
<a name="line31"> 31</a> 
<a name="line32"> 32</a>       <strong>integer*8</strong>  <font color="#2040a0">grid</font>
<a name="line33"> 33</a>       <strong>integer*8</strong>  <font color="#2040a0">graph</font>
<a name="line34"> 34</a>       <strong>integer*8</strong>  <font color="#2040a0">stencil</font>
<a name="line35"> 35</a>       <strong>integer*8</strong>  <font color="#2040a0">A</font>
<a name="line36"> 36</a>       <strong>integer*8</strong>  <font color="#2040a0">b</font>
<a name="line37"> 37</a>       <strong>integer*8</strong>  <font color="#2040a0">x</font>
<a name="line38"> 38</a> 
<a name="line39"> 39</a>       <strong>integer</strong>    <font color="#2040a0">nparts</font>
<a name="line40"> 40</a>       <strong>integer</strong>    <font color="#2040a0">nvars</font>
<a name="line41"> 41</a>       <strong>integer</strong>    <font color="#2040a0">part</font>
<a name="line42"> 42</a>       <strong>integer</strong>    <font color="#2040a0">var</font>
<a name="line43"> 43</a> 
<a name="line44"> 44</a>       <strong>integer</strong>    <font color="#2040a0">precond_id</font>, <font color="#2040a0">object_type</font>
<a name="line45"> 45</a> 
<a name="line46"> 46</a>       <strong>integer</strong>    <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font>, <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font>
<a name="line47"> 47</a>       <strong>integer</strong>    <font color="#2040a0">vartypes</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line48"> 48</a>       <strong>integer</strong>    <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">2</font>,<font color="#FF0000">5</font><font color="4444FF">)</font>
<a name="line49"> 49</a>       <strong>integer</strong>    <font color="#2040a0">ent</font>
<a name="line50"> 50</a>       <strong>integer</strong>    <font color="#2040a0">nentries</font>, <font color="#2040a0">nvalues</font>, <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#FF0000">5</font><font color="4444FF">)</font>
<a name="line51"> 51</a> 
<a name="line52"> 52</a>       <strong>double precision</strong>  <font color="#2040a0">values</font><font color="4444FF">(</font><font color="#FF0000">100</font><font color="4444FF">)</font>, <font color="#2040a0">tol</font>
<a name="line53"> 53</a> 
<a name="line54"> 54</a> <font color="#444444">c     This comes from 'sstruct_mv/HYPRE_sstruct_mv.h'</font>
<a name="line55"> 55</a>       <strong>integer</strong>    <font color="#2040a0">HYPRE_SSTRUCT_VARIABLE_NODE</font>
<a name="line56"> 56</a>       <strong>parameter</strong><font color="4444FF">(</font> <font color="#2040a0">HYPRE_SSTRUCT_VARIABLE_NODE</font> <font color="4444FF">=</font> <font color="#FF0000">1</font> <font color="4444FF">)</font>
<a name="line57"> 57</a> 
<a name="line58"> 58</a>       <strong>integer*8</strong>  <font color="#2040a0">sA</font>
<a name="line59"> 59</a>       <strong>integer*8</strong>  <font color="#2040a0">sb</font>
<a name="line60"> 60</a>       <strong>integer*8</strong>  <font color="#2040a0">sx</font>
<a name="line61"> 61</a>       <strong>integer*8</strong>  <font color="#2040a0">parA</font>
<a name="line62"> 62</a>       <strong>integer*8</strong>  <font color="#2040a0">parb</font>
<a name="line63"> 63</a>       <strong>integer*8</strong>  <font color="#2040a0">parx</font>
<a name="line64"> 64</a>       <strong>integer*8</strong>  <font color="#2040a0">solver</font>
<a name="line65"> 65</a>       <strong>integer*8</strong>  <font color="#2040a0">precond</font>
<a name="line66"> 66</a> 
<a name="line67"> 67</a>       <strong>character*32</strong>  <font color="#2040a0">matfile</font>
<a name="line68"> 68</a> 
<a name="line69"> 69</a> <font color="#444444">c     We only have one part and one variable</font>
<a name="line70"> 70</a>       <font color="#2040a0">nparts</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>
<a name="line71"> 71</a>       <font color="#2040a0">nvars</font>  <font color="4444FF">=</font> <font color="#FF0000">1</font>
<a name="line72"> 72</a>       <font color="#2040a0">part</font>   <font color="4444FF">=</font> <font color="#FF0000">0</font>
<a name="line73"> 73</a>       <font color="#2040a0">var</font>    <font color="4444FF">=</font> <font color="#FF0000">0</font>
<a name="line74"> 74</a> 
<a name="line75"> 75</a> <font color="#444444">c     Initialize MPI</font>
<a name="line76"> 76</a>       <strong>call</strong> <font color="#2040a0">MPI_Init</font><font color="4444FF">(</font><font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line77"> 77</a>       <strong>call</strong> <font color="#2040a0">MPI_Comm_rank</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">myid</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line78"> 78</a>       <strong>call</strong> <font color="#2040a0">MPI_Comm_size</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">num_procs</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line79"> 79</a> 
<a name="line80"> 80</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">num_procs</font> .<font color="#2040a0">ne</font>. <font color="#FF0000">2</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line81"> 81</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">0</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line82"> 82</a>             <strong>print</strong> <font color="4444FF">*</font>, <font color="#008000">&quot;Must run with 2 processors!&quot;</font>
<a name="line83"> 83</a>             <strong>stop</strong>
<a name="line84"> 84</a>          <strong>endif</strong>
<a name="line85"> 85</a>       <strong>endif</strong>
<a name="line86"> 86</a> 
<a name="line87"> 87</a> <font color="#444444">c     Set preconditioner id (PFMG = 1, BoomerAMG = 2)</font>
<a name="line88"> 88</a>       <font color="#2040a0">precond_id</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>
<a name="line89"> 89</a> 
<a name="line90"> 90</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">precond_id</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">1</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line91"> 91</a>          <font color="#2040a0">object_type</font> <font color="4444FF">=</font> <font color="#2040a0">HYPRE_STRUCT</font>
<a name="line92"> 92</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">precond_id</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">2</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line93"> 93</a>          <font color="#2040a0">object_type</font> <font color="4444FF">=</font> <font color="#2040a0">HYPRE_PARCSR</font>
<a name="line94"> 94</a>       <strong>else</strong>
<a name="line95"> 95</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">0</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line96"> 96</a>             <strong>print</strong> <font color="4444FF">*</font>, <font color="#008000">&quot;Invalid solver!&quot;</font>
<a name="line97"> 97</a>             <strong>stop</strong>
<a name="line98"> 98</a>          <strong>endif</strong>
<a name="line99"> 99</a>       <strong>endif</strong>
<a name="line100">100</a> 
<a name="line101">101</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line102">102</a> <font color="#444444">c     1. Set up the grid.  Here we use only one part.  Each processor</font>
<a name="line103">103</a> <font color="#444444">c     describes the piece of the grid that it owns.</font>
<a name="line104">104</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line105">105</a> 
<a name="line106">106</a> <font color="#444444">c     Create an empty 2D grid object</font>
<a name="line107">107</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGridCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#FF0000">2</font>, <font color="#2040a0">nparts</font>, <font color="#2040a0">grid</font>,
<a name="line108">108</a>      <font color="4444FF">+</font>     <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line109">109</a> 
<a name="line110">110</a> <font color="#444444">c     Add boxes to the grid</font>
<a name="line111">111</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">0</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line112">112</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">3</font>
<a name="line113">113</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">1</font>
<a name="line114">114</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line115">115</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line116">116</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructGridSetExtents</font><font color="4444FF">(</font><font color="#2040a0">grid</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line117">117</a>      <font color="4444FF">+</font>        <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line118">118</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">1</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line119">119</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line120">120</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">1</font>
<a name="line121">121</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line122">122</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">4</font>
<a name="line123">123</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructGridSetExtents</font><font color="4444FF">(</font><font color="#2040a0">grid</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line124">124</a>      <font color="4444FF">+</font>        <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line125">125</a>       <strong>endif</strong>
<a name="line126">126</a> 
<a name="line127">127</a> <font color="#444444">c     Set the variable type and number of variables on each part</font>
<a name="line128">128</a>       <font color="#2040a0">vartypes</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#2040a0">HYPRE_SSTRUCT_VARIABLE_NODE</font>
<a name="line129">129</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGridSetVariables</font><font color="4444FF">(</font><font color="#2040a0">grid</font>, <font color="#2040a0">part</font>, <font color="#2040a0">nvars</font>, <font color="#2040a0">vartypes</font>,
<a name="line130">130</a>      <font color="4444FF">+</font>     <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line131">131</a> 
<a name="line132">132</a> <font color="#444444">c     This is a collective call finalizing the grid assembly</font>
<a name="line133">133</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGridAssemble</font><font color="4444FF">(</font><font color="#2040a0">grid</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line134">134</a> 
<a name="line135">135</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line136">136</a> <font color="#444444">c     2. Define the discretization stencil</font>
<a name="line137">137</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line138">138</a> 
<a name="line139">139</a> <font color="#444444">c     Create an empty 2D, 5-pt stencil object</font>
<a name="line140">140</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructStencilCreate</font><font color="4444FF">(</font><font color="#FF0000">2</font>, <font color="#FF0000">5</font>, <font color="#2040a0">stencil</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line141">141</a> 
<a name="line142">142</a> <font color="#444444">c     Define the geometry of the stencil.  Each represents a relative</font>
<a name="line143">143</a> <font color="#444444">c     offset (in the index space).</font>
<a name="line144">144</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">1</font>,<font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line145">145</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">2</font>,<font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line146">146</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">1</font>,<font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line147">147</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">2</font>,<font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line148">148</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">1</font>,<font color="#FF0000">3</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">1</font>
<a name="line149">149</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">2</font>,<font color="#FF0000">3</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line150">150</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">1</font>,<font color="#FF0000">4</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line151">151</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">2</font>,<font color="#FF0000">4</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line152">152</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">1</font>,<font color="#FF0000">5</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line153">153</a>       <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">2</font>,<font color="#FF0000">5</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">1</font>
<a name="line154">154</a> 
<a name="line155">155</a> <font color="#444444">c     Assign numerical values to the offsets so that we can easily refer</font>
<a name="line156">156</a> <font color="#444444">c     to them - the last argument indicates the variable for which we</font>
<a name="line157">157</a> <font color="#444444">c     are assigning this stencil</font>
<a name="line158">158</a>       <strong>do</strong> <font color="#2040a0">ent</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#FF0000">5</font>
<a name="line159">159</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructStencilSetEntry</font><font color="4444FF">(</font><font color="#2040a0">stencil</font>,
<a name="line160">160</a>      <font color="4444FF">+</font>        <font color="#2040a0">ent</font><font color="4444FF">-</font><font color="#FF0000">1</font>, <font color="#2040a0">offsets</font><font color="4444FF">(</font><font color="#FF0000">1</font>,<font color="#2040a0">ent</font><font color="4444FF">)</font>, <font color="#2040a0">var</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line161">161</a>       <font color="#2040a0">enddo</font>
<a name="line162">162</a> 
<a name="line163">163</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line164">164</a> <font color="#444444">c     3. Set up the Graph - this determines the non-zero structure of</font>
<a name="line165">165</a> <font color="#444444">c     the matrix and allows non-stencil relationships between the parts</font>
<a name="line166">166</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line167">167</a> 
<a name="line168">168</a> <font color="#444444">c     Create the graph object</font>
<a name="line169">169</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGraphCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">grid</font>, <font color="#2040a0">graph</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line170">170</a> 
<a name="line171">171</a> <font color="#444444">c     See MatrixSetObjectType below</font>
<a name="line172">172</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGraphSetObjectType</font><font color="4444FF">(</font><font color="#2040a0">graph</font>, <font color="#2040a0">object_type</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line173">173</a> 
<a name="line174">174</a> <font color="#444444">c     Now we need to tell the graph which stencil to use for each</font>
<a name="line175">175</a> <font color="#444444">c     variable on each part (we only have one variable and one part)</font>
<a name="line176">176</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGraphSetStencil</font><font color="4444FF">(</font><font color="#2040a0">graph</font>, <font color="#2040a0">part</font>, <font color="#2040a0">var</font>, <font color="#2040a0">stencil</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line177">177</a> 
<a name="line178">178</a> <font color="#444444">c     Here we could establish connections between parts if we had more</font>
<a name="line179">179</a> <font color="#444444">c     than one part using the graph. For example, we could use</font>
<a name="line180">180</a> <font color="#444444">c     HYPRE_GraphAddEntries() routine or HYPRE_GridSetNeighborPart()</font>
<a name="line181">181</a> 
<a name="line182">182</a> <font color="#444444">c     Assemble the graph</font>
<a name="line183">183</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGraphAssemble</font><font color="4444FF">(</font><font color="#2040a0">graph</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line184">184</a> 
<a name="line185">185</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line186">186</a> <font color="#444444">c     4. Set up a SStruct Matrix</font>
<a name="line187">187</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line188">188</a> 
<a name="line189">189</a> <font color="#444444">c     Create an empty matrix object</font>
<a name="line190">190</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">graph</font>, <font color="#2040a0">A</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line191">191</a> 
<a name="line192">192</a> <font color="#444444">c     Set the object type (by default HYPRE_SSTRUCT). This determines</font>
<a name="line193">193</a> <font color="#444444">c     the data structure used to store the matrix.  For PFMG we use</font>
<a name="line194">194</a> <font color="#444444">c     HYPRE_STRUCT, and for BoomerAMG we use HYPRE_PARCSR (set above).</font>
<a name="line195">195</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetObjectTyp</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">object_type</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line196">196</a> 
<a name="line197">197</a> <font color="#444444">c     Get ready to set values</font>
<a name="line198">198</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixInitialize</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line199">199</a> 
<a name="line200">200</a> <font color="#444444">c     Set the matrix coefficients.  Each processor assigns coefficients</font>
<a name="line201">201</a> <font color="#444444">c     for the boxes in the grid that it owns.  Note that the</font>
<a name="line202">202</a> <font color="#444444">c     coefficients associated with each stencil entry may vary from grid</font>
<a name="line203">203</a> <font color="#444444">c     point to grid point if desired.  Here, we first set the same</font>
<a name="line204">204</a> <font color="#444444">c     stencil entries for each grid point.  Then we make modifications</font>
<a name="line205">205</a> <font color="#444444">c     to grid points near the boundary.  Note that the ilower values are</font>
<a name="line206">206</a> <font color="#444444">c     different from those used in ex1 because of the way nodal</font>
<a name="line207">207</a> <font color="#444444">c     variables are referenced.  Also note that some of the stencil</font>
<a name="line208">208</a> <font color="#444444">c     values are set on both processor 0 and processor 1.  See the User</font>
<a name="line209">209</a> <font color="#444444">c     and Reference manuals for more details.</font>
<a name="line210">210</a> 
<a name="line211">211</a> <font color="#444444">c     Stencil entry labels correspond to the offsets defined above</font>
<a name="line212">212</a>       <strong>do</strong> <font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#FF0000">5</font>
<a name="line213">213</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#2040a0">i</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#2040a0">i</font><font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line214">214</a>       <font color="#2040a0">enddo</font>
<a name="line215">215</a>       <font color="#2040a0">nentries</font> <font color="4444FF">=</font> <font color="#FF0000">5</font>
<a name="line216">216</a> 
<a name="line217">217</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">0</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line218">218</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">4</font>
<a name="line219">219</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line220">220</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line221">221</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line222">222</a> <font color="#444444">c        12 grid points, each with 5 stencil entries</font>
<a name="line223">223</a>          <font color="#2040a0">nvalues</font> <font color="4444FF">=</font> <font color="#FF0000">60</font> 
<a name="line224">224</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">1</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line225">225</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line226">226</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line227">227</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line228">228</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">4</font>
<a name="line229">229</a> <font color="#444444">c        12 grid points, each with 5 stencil entries</font>
<a name="line230">230</a>          <font color="#2040a0">nvalues</font> <font color="4444FF">=</font> <font color="#FF0000">100</font> 
<a name="line231">231</a>       <strong>endif</strong>
<a name="line232">232</a> 
<a name="line233">233</a>       <strong>do</strong> <font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#2040a0">nvalues</font>, <font color="#2040a0">nentries</font>
<a name="line234">234</a>          <font color="#2040a0">values</font><font color="4444FF">(</font><font color="#2040a0">i</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">4.0</font>
<a name="line235">235</a>          <strong>do</strong> <font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#2040a0">nentries</font><font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line236">236</a>             <font color="#2040a0">values</font><font color="4444FF">(</font><font color="#2040a0">i</font><font color="4444FF">+</font><font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1.0</font>
<a name="line237">237</a>          <font color="#2040a0">enddo</font>
<a name="line238">238</a>       <font color="#2040a0">enddo</font>
<a name="line239">239</a> 
<a name="line240">240</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line241">241</a>      <font color="4444FF">+</font>     <font color="#2040a0">var</font>, <font color="#2040a0">nentries</font>, <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line242">242</a> 
<a name="line243">243</a> <font color="#444444">c     Set the coefficients reaching outside of the boundary to 0.  Note</font>
<a name="line244">244</a> <font color="#444444">c     that both ilower *and* iupper may be different from those in ex1.</font>
<a name="line245">245</a> 
<a name="line246">246</a>       <strong>do</strong> <font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#FF0000">5</font>
<a name="line247">247</a>          <font color="#2040a0">values</font><font color="4444FF">(</font><font color="#2040a0">i</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font>
<a name="line248">248</a>       <font color="#2040a0">enddo</font>
<a name="line249">249</a> 
<a name="line250">250</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">0</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line251">251</a> 
<a name="line252">252</a> <font color="#444444">c        values below our box</font>
<a name="line253">253</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">4</font>
<a name="line254">254</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line255">255</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line256">256</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line257">257</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">3</font>
<a name="line258">258</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line259">259</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#FF0000">1</font>, <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line260">260</a> <font color="#444444">c        values to the left of our box</font>
<a name="line261">261</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">4</font>
<a name="line262">262</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line263">263</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">4</font>
<a name="line264">264</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line265">265</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>
<a name="line266">266</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line267">267</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#FF0000">1</font>, <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line268">268</a> <font color="#444444">c        values above our box</font>
<a name="line269">269</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">4</font>
<a name="line270">270</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line271">271</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">2</font>
<a name="line272">272</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line273">273</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">4</font>
<a name="line274">274</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line275">275</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#FF0000">1</font>, <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line276">276</a> 
<a name="line277">277</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">1</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line278">278</a> 
<a name="line279">279</a> <font color="#444444">c        values below our box</font>
<a name="line280">280</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line281">281</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line282">282</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line283">283</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line284">284</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">3</font>
<a name="line285">285</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line286">286</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#FF0000">1</font>, <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line287">287</a> <font color="#444444">c        values to the right of our box</font>
<a name="line288">288</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line289">289</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line290">290</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line291">291</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">4</font>
<a name="line292">292</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">2</font>
<a name="line293">293</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line294">294</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#FF0000">1</font>, <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line295">295</a> <font color="#444444">c        values above our box</font>
<a name="line296">296</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line297">297</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">4</font>
<a name="line298">298</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line299">299</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">4</font>
<a name="line300">300</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">4</font>
<a name="line301">301</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line302">302</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#FF0000">1</font>, <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line303">303</a> <font color="#444444">c        values to the left of our box</font>
<a name="line304">304</a> <font color="#444444">c        (that do not border the other box on proc. 0)</font>
<a name="line305">305</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line306">306</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">3</font>
<a name="line307">307</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line308">308</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">4</font>
<a name="line309">309</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>
<a name="line310">310</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line311">311</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#FF0000">1</font>, <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line312">312</a> 
<a name="line313">313</a>       <strong>endif</strong>
<a name="line314">314</a> 
<a name="line315">315</a> <font color="#444444">c     This is a collective call finalizing the matrix assembly</font>
<a name="line316">316</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixAssemble</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line317">317</a> 
<a name="line318">318</a> <font color="#444444">c      matfile = 'ex12f.out'</font>
<a name="line319">319</a> <font color="#444444">c      matfile(10:10) = char(0)</font>
<a name="line320">320</a> <font color="#444444">c      call HYPRE_SStructMatrixPrint(matfile, A, 0, ierr)</font>
<a name="line321">321</a> 
<a name="line322">322</a> <font color="#444444">c     Create an empty vector object</font>
<a name="line323">323</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">grid</font>, <font color="#2040a0">b</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line324">324</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">grid</font>, <font color="#2040a0">x</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line325">325</a> 
<a name="line326">326</a> <font color="#444444">c     As with the matrix, set the appropriate object type for the vectors</font>
<a name="line327">327</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorSetObjectTyp</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">object_type</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line328">328</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorSetObjectTyp</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">object_type</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line329">329</a> 
<a name="line330">330</a> <font color="#444444">c     Indicate that the vector coefficients are ready to be set</font>
<a name="line331">331</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorInitialize</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line332">332</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorInitialize</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line333">333</a> 
<a name="line334">334</a> <font color="#444444">c     Set the vector coefficients.  Again, note that the ilower values</font>
<a name="line335">335</a> <font color="#444444">c     are different from those used in ex1, and some of the values are</font>
<a name="line336">336</a> <font color="#444444">c     set on both processors.</font>
<a name="line337">337</a> 
<a name="line338">338</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">0</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line339">339</a> 
<a name="line340">340</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">4</font>
<a name="line341">341</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line342">342</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="4444FF">-</font><font color="#FF0000">1</font>
<a name="line343">343</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line344">344</a> 
<a name="line345">345</a>          <strong>do</strong> <font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#FF0000">12</font>
<a name="line346">346</a>             <font color="#2040a0">values</font><font color="4444FF">(</font><font color="#2040a0">i</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">1.0</font>
<a name="line347">347</a>          <font color="#2040a0">enddo</font>
<a name="line348">348</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line349">349</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line350">350</a>          <strong>do</strong> <font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#FF0000">12</font>
<a name="line351">351</a>             <font color="#2040a0">values</font><font color="4444FF">(</font><font color="#2040a0">i</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font>
<a name="line352">352</a>          <font color="#2040a0">enddo</font>
<a name="line353">353</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line354">354</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line355">355</a> 
<a name="line356">356</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">1</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line357">357</a> 
<a name="line358">358</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">0</font>
<a name="line359">359</a>          <font color="#2040a0">ilower</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">1</font>
<a name="line360">360</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">2</font>
<a name="line361">361</a>          <font color="#2040a0">iupper</font><font color="4444FF">(</font><font color="#FF0000">2</font><font color="4444FF">)</font> <font color="4444FF">=</font>  <font color="#FF0000">4</font>
<a name="line362">362</a> 
<a name="line363">363</a>          <strong>do</strong> <font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#FF0000">20</font>
<a name="line364">364</a>             <font color="#2040a0">values</font><font color="4444FF">(</font><font color="#2040a0">i</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">1.0</font>
<a name="line365">365</a>          <font color="#2040a0">enddo</font>
<a name="line366">366</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line367">367</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line368">368</a>          <strong>do</strong> <font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">1</font>, <font color="#FF0000">20</font>
<a name="line369">369</a>             <font color="#2040a0">values</font><font color="4444FF">(</font><font color="#2040a0">i</font><font color="4444FF">)</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font>
<a name="line370">370</a>          <font color="#2040a0">enddo</font>
<a name="line371">371</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">part</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>,
<a name="line372">372</a>      <font color="4444FF">+</font>        <font color="#2040a0">var</font>, <font color="#2040a0">values</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line373">373</a> 
<a name="line374">374</a>       <strong>endif</strong>
<a name="line375">375</a> 
<a name="line376">376</a> <font color="#444444">c     This is a collective call finalizing the vector assembly</font>
<a name="line377">377</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorAssemble</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line378">378</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorAssemble</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line379">379</a> 
<a name="line380">380</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line381">381</a> <font color="#444444">c     6. Set up and use a solver (See the Reference Manual for</font>
<a name="line382">382</a> <font color="#444444">c     descriptions of all of the options.)</font>
<a name="line383">383</a> <font color="#444444">c-----------------------------------------------------------------------</font>
<a name="line384">384</a> 
<a name="line385">385</a>       <font color="#2040a0">tol</font> <font color="4444FF">=</font> <font color="#FF0000">1.0E-6</font>
<a name="line386">386</a> 
<a name="line387">387</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">precond_id</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">1</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line388">388</a> 
<a name="line389">389</a> <font color="#444444">c        PFMG</font>
<a name="line390">390</a> 
<a name="line391">391</a> <font color="#444444">c        Because we are using a struct solver, we need to get the object</font>
<a name="line392">392</a> <font color="#444444">c        of the matrix and vectors to pass in to the struct solvers</font>
<a name="line393">393</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixGetObject</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">sA</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line394">394</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorGetObject</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">sb</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line395">395</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorGetObject</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">sx</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line396">396</a> 
<a name="line397">397</a> <font color="#444444">c        Create an empty PCG Struct solver</font>
<a name="line398">398</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPCGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">solver</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line399">399</a> <font color="#444444">c        Set PCG parameters</font>
<a name="line400">400</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPCGSetTol</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">tol</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line401">401</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPCGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">2</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line402">402</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPCGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">50</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line403">403</a> 
<a name="line404">404</a> <font color="#444444">c        Create the Struct PFMG solver for use as a preconditioner</font>
<a name="line405">405</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">precond</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line406">406</a> <font color="#444444">c        Set PFMG parameters</font>
<a name="line407">407</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line408">408</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGSetTol</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0.0</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line409">409</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGSetZeroGuess</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line410">410</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGSetNumPreRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">2</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line411">411</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGSetNumPostRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">2</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line412">412</a> <font color="#444444">c        Non-Galerkin coarse grid (more efficient for this problem)</font>
<a name="line413">413</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGSetRAPType</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line414">414</a> <font color="#444444">c        R/B Gauss-Seidel</font>
<a name="line415">415</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGSetRelaxType</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">2</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line416">416</a> <font color="#444444">c        Skip relaxation on some levels (more efficient for this problem)</font>
<a name="line417">417</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGSetSkipRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line418">418</a> <font color="#444444">c        Set preconditioner (PFMG = 1) and solve</font>
<a name="line419">419</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPCGSetPrecond</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1</font>, <font color="#2040a0">precond</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line420">420</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPCGSetup</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">sA</font>, <font color="#2040a0">sb</font>, <font color="#2040a0">sx</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line421">421</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPCGSolve</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">sA</font>, <font color="#2040a0">sb</font>, <font color="#2040a0">sx</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line422">422</a> 
<a name="line423">423</a> <font color="#444444">c        Free memory</font>
<a name="line424">424</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPCGDestroy</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line425">425</a>          <strong>call</strong> <font color="#2040a0">HYPRE_StructPFMGDestroy</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line426">426</a> 
<a name="line427">427</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">precond_id</font> .<font color="#2040a0">eq</font>. <font color="#FF0000">2</font><font color="4444FF">)</font> <strong>then</strong>
<a name="line428">428</a> 
<a name="line429">429</a> <font color="#444444">c        BoomerAMG</font>
<a name="line430">430</a> 
<a name="line431">431</a> <font color="#444444">c        Because we are using a struct solver, we need to get the object</font>
<a name="line432">432</a> <font color="#444444">c        of the matrix and vectors to pass in to the struct solvers</font>
<a name="line433">433</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixGetObject</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">parA</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line434">434</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorGetObject</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">parb</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line435">435</a>          <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorGetObject</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">parx</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line436">436</a> 
<a name="line437">437</a> <font color="#444444">c        Create an empty PCG Struct solver</font>
<a name="line438">438</a>          <strong>call</strong> <font color="#2040a0">HYPRE_ParCSRPCGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">solver</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line439">439</a> <font color="#444444">c        Set PCG parameters</font>
<a name="line440">440</a>          <strong>call</strong> <font color="#2040a0">HYPRE_ParCSRPCGSetTol</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">tol</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line441">441</a>          <strong>call</strong> <font color="#2040a0">HYPRE_ParCSRPCGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">2</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line442">442</a>          <strong>call</strong> <font color="#2040a0">HYPRE_ParCSRPCGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">50</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line443">443</a> 
<a name="line444">444</a> <font color="#444444">c        Create the BoomerAMG solver for use as a preconditioner</font>
<a name="line445">445</a>          <strong>call</strong> <font color="#2040a0">HYPRE_BoomerAMGCreate</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line446">446</a> <font color="#444444">c        Set BoomerAMG parameters</font>
<a name="line447">447</a>          <strong>call</strong> <font color="#2040a0">HYPRE_BoomerAMGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line448">448</a>          <strong>call</strong> <font color="#2040a0">HYPRE_BoomerAMGSetTol</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0.0</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line449">449</a> <font color="#444444">c        Print amg solution info</font>
<a name="line450">450</a>          <strong>call</strong> <font color="#2040a0">HYPRE_BoomerAMGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line451">451</a>          <strong>call</strong> <font color="#2040a0">HYPRE_BoomerAMGSetCoarsenType</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">6</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line452">452</a> <font color="#444444">c        Sym G.S./Jacobi hybrid</font>
<a name="line453">453</a>          <strong>call</strong> <font color="#2040a0">HYPRE_BoomerAMGSetRelaxType</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">6</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line454">454</a>          <strong>call</strong> <font color="#2040a0">HYPRE_BoomerAMGSetNumSweeps</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line455">455</a> <font color="#444444">c        Set preconditioner (BoomerAMG = 2) and solve</font>
<a name="line456">456</a>          <strong>call</strong> <font color="#2040a0">HYPRE_ParCSRPCGSetPrecond</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">2</font>, <font color="#2040a0">precond</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line457">457</a>          <strong>call</strong> <font color="#2040a0">HYPRE_ParCSRPCGSetup</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">parA</font>, <font color="#2040a0">parb</font>, <font color="#2040a0">parx</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line458">458</a>          <strong>call</strong> <font color="#2040a0">HYPRE_ParCSRPCGSolve</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">parA</font>, <font color="#2040a0">parb</font>, <font color="#2040a0">parx</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line459">459</a> 
<a name="line460">460</a> <font color="#444444">c        Free memory</font>
<a name="line461">461</a>          <strong>call</strong> <font color="#2040a0">HYPRE_ParCSRPCGDestroy</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line462">462</a>          <strong>call</strong> <font color="#2040a0">HYPRE_BoomerAMGDestroy</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line463">463</a> 
<a name="line464">464</a>       <strong>endif</strong>
<a name="line465">465</a> 
<a name="line466">466</a> <font color="#444444">c     Free memory</font>
<a name="line467">467</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGridDestroy</font><font color="4444FF">(</font><font color="#2040a0">grid</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line468">468</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructStencilDestroy</font><font color="4444FF">(</font><font color="#2040a0">stencil</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line469">469</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructGraphDestroy</font><font color="4444FF">(</font><font color="#2040a0">graph</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line470">470</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructMatrixDestroy</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line471">471</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorDestroy</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line472">472</a>       <strong>call</strong> <font color="#2040a0">HYPRE_SStructVectorDestroy</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line473">473</a> 
<a name="line474">474</a> <font color="#444444">c     Finalize MPI</font>
<a name="line475">475</a>       <strong>call</strong> <font color="#2040a0">MPI_Finalize</font><font color="4444FF">(</font><font color="#2040a0">ierr</font><font color="4444FF">)</font>
<a name="line476">476</a> 
<a name="line477">477</a>       <strong>stop</strong>
<a name="line478">478</a>       <strong>end</strong>

</pre>
<hr>
syntax highlighted by <a href="http://www.palfrader.org/code2html">Code2HTML</a>, v. 0.9.1
</body>
</html>
